﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace TangoFamilyAndGuide.Site
{
    public partial class Master : System.Web.UI.MasterPage
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Entidades.Sesion sesion = (Entidades.Sesion)Session["Sesion"];
                Funciones.PersonalizarControlesMaster(this, true, sesion);
            }
        }
        protected void Menu_MenuItemClick(object sender, MenuEventArgs e)
        {
            Entidades.Sesion sesion = (Entidades.Sesion)Session["Sesion"];
            switch (Menu.SelectedItem.ValuePath)
            {
                //case "Página principal":
                //    Response.Redirect("~/Home.aspx");
                //    break;
                case "Login":
                    Response.Redirect("~/UsuarioLogin.aspx");
                    break;
                case "Milongas|New":
                    Response.Redirect("~/MilongaCrear.aspx");
                    break;
                case "Milongas|Change Status":
                    Response.Redirect("~/MilongaSeleccionar.aspx?ChangeStatus");
                    break;
                case "Milongas|Modify":
                    Response.Redirect("~/MilongaSeleccionar.aspx?Modify");
                    break;
                case "Milongas|Images":
                    Response.Redirect("~/MilongaSeleccionar.aspx?Images");
                    break;
                case "Milongas|List":
                    Response.Redirect("~/MilongaConsulta.aspx");
                    break;
                case "Festivals|New":
                    Response.Redirect("~/FestivalCrear.aspx");
                    break;
                case "Festivals|Change Status":
                    Response.Redirect("~/FestivalSeleccionar.aspx?ChangeStatus");
                    break;
                case "Festivals|Modify":
                    Response.Redirect("~/FestivalSeleccionar.aspx?Modify");
                    break;
                case "Festivals|Images":
                    Response.Redirect("~/FestivalSeleccionar.aspx?Images");
                    break;
                case "Festivals|List":
                    Response.Redirect("~/FestivalConsulta.aspx");
                    break;
                case "Teachers & Taxi Dancers|New":
                    Response.Redirect("~/ProfesorCrear.aspx");
                    break;
                case "Teachers & Taxi Dancers|Change Status":
                    Response.Redirect("~/ProfesorSeleccionar.aspx?ChangeStatus");
                    break;
                case "Teachers & Taxi Dancers|Modify":
                    Response.Redirect("~/ProfesorSeleccionar.aspx?Modify");
                    break;
                case "Teachers & Taxi Dancers|Images":
                    Response.Redirect("~/ProfesorSeleccionar.aspx?Images");
                    break;
                case "Teachers & Taxi Dancers|List":
                    Response.Redirect("~/ProfesorConsulta.aspx");
                    break;
                case "Rentals by Owners|New":
                    Response.Redirect("~/AlojamientoCrear.aspx");
                    break;
                case "Rentals by Owners|Change Status":
                    Response.Redirect("~/AlojamientoSeleccionar.aspx?ChangeStatus");
                    break;
                case "Rentals by Owners|Modify":
                    Response.Redirect("~/AlojamientoSeleccionar.aspx?Modify");
                    break;
                case "Rentals by Owners|Images":
                    Response.Redirect("~/AlojamientoSeleccionar.aspx?Images");
                    break;
                case "Rentals by Owners|List":
                    Response.Redirect("~/AlojamientoConsulta.aspx");
                    break;
                case "Rentals by Owners|Information":
                    Response.Redirect("~/AlojamientoInformation.aspx");
                    break;
                case "Rentals by Owners|Payment":
                    Response.Redirect("~/AlojamientoPayment.aspx");
                    break;
                case "Milonguero Housing Network|New":
                    Response.Redirect("~/HousingCrear.aspx");
                    break;
                case "Milonguero Housing Network|Change Status":
                    Response.Redirect("~/HousingSeleccionar.aspx?ChangeStatus");
                    break;
                case "Milonguero Housing Network|Modify":
                    Response.Redirect("~/HousingSeleccionar.aspx?Modify");
                    break;
                case "Milonguero Housing Network|Images":
                    Response.Redirect("~/HousingSeleccionar.aspx?Images");
                    break;
                case "Milonguero Housing Network|List":
                    Response.Redirect("~/HousingConsulta.aspx");
                    break;
                case "Milonguero Housing Network|Information":
                    Response.Redirect("~/HousingInformation.aspx");
                    break;
                case "Milonguero Housing Network|Payment":
                    Response.Redirect("~/HousingPayment.aspx");
                    break;
                case "Casting Offers for Artist|New":
                    Response.Redirect("~/CastingArtistsOfferCrear.aspx");
                    break;
                case "Casting Offers for Artist|Change Status":
                    Response.Redirect("~/CastingArtistsOfferSeleccionar.aspx?ChangeStatus");
                    break;
                case "Casting Offers for Artist|Modify":
                    Response.Redirect("~/CastingArtistsOfferSeleccionar.aspx?Modify");
                    break;
                case "Casting Offers for Artist|Images":
                    Response.Redirect("~/CastingArtistsOfferSeleccionar.aspx?Images");
                    break;
                case "Casting Offers for Artist|List":
                    Response.Redirect("~/CastingArtistsOfferConsulta.aspx");
                    break;
                case "Job Posting|New":
                    Response.Redirect("~/CastingArtistsCallCrear.aspx");
                    break;
                case "Job Posting|Change Status":
                    Response.Redirect("~/CastingArtistsCallSeleccionar.aspx?ChangeStatus");
                    break;
                case "Job Posting|Modify":
                    Response.Redirect("~/CastingArtistsCallSeleccionar.aspx?Modify");
                    break;
                case "Job Posting|List":
                    Response.Redirect("~/CastingArtistsCallConsulta.aspx");
                    break;
                case "Configuration|Change user password":
                    Response.Redirect("~/UsuarioCambiarPassword.aspx");
                    break;
                case "Configuration|Modify configuration":
                    Response.Redirect("~/ConfiguracionModificar.aspx");
                    break;
                case "Configuration|Terms and conditions":
                    Response.Redirect("~/TyC.aspx");
                    break;
                case "Administración Site|Explorador de Usuarios":
                    Response.Redirect("~/ExploradorUsuarios.aspx");
                    break;
                case "Administración Site|Explorador de Permisos":
                    Response.Redirect("~/ExploradorPermiso.aspx");
                    break;
                case "Administración Site|Explorador de Milongas":
                    Response.Redirect("~/ExploradorMilonga.aspx");
                    break;
                case "Administración Site|Explorador de Festivales":
                    Response.Redirect("~/ExploradorFestival.aspx");
                    break;
                case "Administración Site|Explorador de Profesores":
                    Response.Redirect("~/ExploradorProfesor.aspx");
                    break;
                case "Administración Site|Explorador de Alojamientos":
                    Response.Redirect("~/ExploradorAlojamiento.aspx");
                    break;
                case "Administración Site|Explorador de Housing":
                    Response.Redirect("~/ExploradorHousing.aspx");
                    break;
                case "Administración Site|Explorador de Casting Offers for Artist":
                    Response.Redirect("~/ExploradorCastingArtistsOffer.aspx");
                    break;
                case "Administración Site|Explorador de Job Posting":
                    Response.Redirect("~/ExploradorCastingCall.aspx");
                    break;
                case "Administración Site|Explorador de Air Ticket":
                    Response.Redirect("~/ExploradorAirTicket.aspx");
                    break;
                case "Administración Site|Explorador de Publicidad":
                    Response.Redirect("~/ExploradorPublicidad.aspx");
                    break;
                case "Administración Site|Explorador de Comentarios":
                    Response.Redirect("~/ExploradorComentario.aspx");
                    break;
                case "Close session":
                    RN.Sesion.Cerrar(sesion);
                    Response.Redirect("~/UsuarioLogin.aspx");
                    break;
            }
        }
        public Color GetItemColor(MenuItemTemplateContainer container)
        {
            MenuItem item = (MenuItem)container.DataItem;
            if (item.Selectable || item.ChildItems.Count > 0)
                return Color.White;
            else
                return Color.Red;
        }
        protected void EmpresaImageButton_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/InstitucionalEmpresa.aspx");
        }
        protected void UsuarioImageButton_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("~/UsuarioConsulta.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Visible = false;
        }
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToLongTimeString();
        }
    }
}
